<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加学生信息</title>

    <script type="text/javascript" src="js/jquery-3.5.1.js"></script>

</head>


<body>

    <form id="form">
        <input type="text" name="id" placeholder="学生学号"> <br>
        <input type="text" name="sname" placeholder="学生姓名"> <br>
        <input type="text" name="gender" placeholder="学生性别"> <br>
        <input type="text" name="birthday" placeholder="学生生日"> <br>
        <input id="button" type="button" value="提交">
        <input id="button1" type="button" value="返回" onclick="back()">
    </form>

</body>

<script>
    $("#button").click(function(){
        $.ajax({
            type:"get",
            url:"/Code/addStudentServlet",
            data:$("#form").serialize(),
            async:true,
            success:function(data){
                var d = eval("("+data+")");
                if(d.isExist){
                    alert("学生信息添加成功！！！");
                }else{
                    alert("学生信息添加失败！！！");
                }
                window.location.href="add.html";
            },
        })
    })
    function back(){
        location.href="view.html";
    }
</script>
</html>